// import type{User,CodeType,UserInfo,PatientList} from '@/type/user'
import {request} from '@/utils/requests'
import type { CodeType, Patient, PatientList, User, UserInfo } from '@/type/user'
export const loginByPasswordAPI=(mobile:string,password:string)=>{
    return  request<User>('/login/password','post',{mobile,password})
}


// 封装发送短信验证码
export const sendCodeAPI=(mobile:string,type:CodeType)=>{
    return request<User>('/code','get',{mobile,type})
}

// 封装短信验证码登录
export const LoginByCodeAPI=(mobile:string,code:string)=>{
    return request<User>('/login','post',{mobile,code})
}




// 获取个人信息
export const getUserInfo = () =>{
 return request<UserInfo>('/patient/myUser','get')
}    

// 获取患者信息
export const getPatientList = () =>{
     return request<PatientList>('/patient/mylist','get')
}    

// 编辑患者信息
// 编辑患者信息
export const editPatient = (patient: Patient) =>
{
    return request<Patient>('/patient/update', 'PUT', patient)

}


// 添加患者

// 添加患者信息
export const addPatient = (patient: Patient) => {

    return request<Patient>('/patient/add', 'POST', patient)
}


// 删除患者信息
export const delPatient = (id: string) => {
   return request(`/patient/del/${id}`, 'DELETE')

}

// 查询患者详情
export const getPatientDetail = (id: string) => request<Patient>(`/patient/info/${id}`)

